<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoresTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('stores', function (Blueprint $table) {
            $table->bigIncrements('id')->unique()->comment('主键ID');
            $table->string('name')->unique()->comment('店名');
            $table->string('address')->comment('地址');
            $table->string('opening_time')->comment('营业开始时间');
            $table->string('closing_time')->comment('营业结束时间');
            $table->string('phone')->comment('联系电话');
            $table->unsignedBigInteger('region_id')->comment('区域ID');
            $table->foreign('region_id')->references('id')->on('regions');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('stores');
    }
}
